# -*-coding:utf-8-*-
f = open("record.txt")
# print (f.read())
# print (f.tell())
# print (f.seek(0,0))
# print (f.read(5))
# print (f.tell())
# print (f.readline())
# print(list(f)) # 整个文件放进列表

# print (f.seek(0,0))
f.seek(0, 0)
# lines= list(f)
# for each_line in lines:
#     print (each_line)
# for each_line in f:
#     print(each_line)

# f= open("record.txt")
# f.write("这是一段待写入的数据")
f.close()
f = open("record.txt", "w")  # 如果要想在原来的内容上追加，一定要使用“a”模式打开文件
f.write("这是一段待写入的数据")
f.close()
# print(f)
import os

# print (os.getcwd())
# os.system("calc")
# for i in os.walk("test"):
#     print(i)

# print(os.path.dirname(r"\a\b\test.txt"))  # 路径名
# print(os.path.basename(r"\a\b\test.txt"))  # 文件名
# print(os.path.join(r"F:\xiaojiayu","record.txt")) # 路径名和文件名组合成一个完整路径
# print (os.path.split(r"a\b\test.txt"))
# print (os.path.splitext(r"a\b\test.txt"))
# print (os.path.splitdrive(r"a\b\test.txt"))
# print (os.chdir(r"F:\xiaojiayu"))
# print (os.path.getsize("record.txt"))

import time

temp = time.localtime(os.path.getatime("record.txt"))
# print("record.txt 被访问的时间是：", time.strftime("%d %b %Y %H:%M:%S", temp))
temp = time.localtime((os.path.getctime("record.txt")))
# print("record.txt 被创建的时间是：", time.strftime("%d %b %Y %H:%M:%S", temp))
temp = time.localtime((os.path.getmtime("record.txt")))
# print("record.txt 被修改的时间是：", time.strftime("%d %b %Y %H:%M:%S", temp))

import pickle

my_list = [123, 3.14, '小甲鱼', ['another list']]
pickle_file = open('F:\\xiaojiayu\\my_list.pkl', 'wb')
pickle.dump(my_list, pickle_file)
pickle_file.close()

pickle_file = open('F:\\xiaojiayu\\my_list.pkl', 'rb')
my_list = pickle.load(pickle_file)
print (my_list)
# 注：利用pickle 模块，不仅可以保存列表，事实上pickple可以保存任何你能想象得到东西